package cn.dm.service;

import cn.dm.client.RestDmItemTypeClient;
import cn.dm.mapper.DmItemTypeMapper;
import cn.dm.pojo.DmItemType;
import cn.dm.vo.DmItemTypeVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class DmItemTypeController {

    @Resource
    private DmItemTypeMapper itemTypeClient;
    @RequestMapping(value = "/getDmItemTypeById", method = RequestMethod.POST)
    public DmItemType getDmItemTypeById(@RequestParam("id") Long id) throws Exception{
        return null;
    }

    @RequestMapping(value = "/getDmItemTypeListByMap", method = RequestMethod.POST)
    public List<DmItemType> getDmItemTypeListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return itemTypeClient.getDmItemTypeListByMap(param);
    }
    @RequestMapping(value = "/getDmItemTypeCountByMap", method = RequestMethod.POST)
    public Integer getDmItemTypeCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return itemTypeClient.getDmItemTypeCountByMap(param);
    }

    @RequestMapping(value = "/qdtxAddDmItemType", method = RequestMethod.POST)
    public Integer qdtxAddDmItemType(@RequestBody DmItemType dmItemType) throws Exception{
        return itemTypeClient.insertDmItemType(dmItemType);
    }

    @RequestMapping(value = "/qdtxModifyDmItemType", method = RequestMethod.POST)
    public Integer qdtxModifyDmItemType(@RequestBody DmItemType dmItemType) throws Exception{
        return itemTypeClient.updateDmItemType(dmItemType);
    }

    @RequestMapping(value = "/selectTestChildren", method = RequestMethod.POST)
    public List<DmItemTypeVo> selectTestChildren() throws Exception{
        System.out.println("provide");
        return itemTypeClient.selectTestChildren();
    }

}
